/*
day277
2020.5.31
*/
#include<iostream>
struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};

class Solution {
public:
    bool isSymmetric(TreeNode* root) {
		if(!root)
		{
			return true;
		 } 
		 
		return issame(root->left,root->right);
    }
    
    bool issame(TreeNode *root1,TreeNode *root2)
	{
		if(!root1 && !root2)
		{
			return true;
		}
		
		if(!root1 || !root2 || root1->val != root2->val)
		{
			return false;
		}
		
		return issame(root1->left,root2->right) && issame(root1->right,root2->left);
	} 
    
};

int main()
{
	return 0;
}
